package com.lei.test;

import com.lei.config.SpringConfiguration;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * @ClassName testAnnoconfinguration
 * @Description TODO
 * @Author Admin
 * @Date 2021/8/4 15:03
 * @Version 1.0
 */
public class testAnnoconfinguration {
    @Test
    public void test() throws SQLException {
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfiguration.class);
        DataSource dataSource = (DataSource) applicationContext.getBean("dataSource");
        System.out.println("dataSource:"+dataSource);
        Connection connection = dataSource.getConnection();
        System.out.println("connection"+connection);



    }
}
